{include file="$header" /}
<div class="mk-app-warp">
    <mk-table
        url="adminMenu/index"
        save-url="adminMenu/save"
        update-url="adminMenu/update"
        delete-url="adminMenu/delete"
        :field="field"
        :date-search="false"
        :keyword-search="false"
        @refresh="getData($event)"
        tree>
    </mk-table>
</div>
{include file="$component" /}
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                field: [
                    {
                        prop: 'title', 
                        label: '名称', 
                        placeholder: '请输入标题', 
                        rules: {required: true, max: 255},
                        refresh: true,
                    },
                    {
                        prop: 'pid', 
                        label: '父级', 
                        type: 'select', 
                        option: [], 
                        self: true, 
                        tree: true, 
                        props:{label: 'title', value: 'id'}, 
                        rules: {required: true},
                        table: false
                    },
                    {
                        prop: 'path',
                        label: '路径', 
                        placeholder: '请输入控制器/方法名', 
                        tips:'开启一键curd后，此处请填写表名称如:mk_banner，系统根据表名称生成Banner控制器、Banner模型、视图、增删改查权限菜单',
                        rules: {required: true, max: 255},
                        table: false
                    },
                    {
                        prop: 'sort', 
                        label: '排序', 
                        placeholder: '降序排序，值越大越靠前', 
                        rules: {required: true},
                        default: 0, 
                        table: false
                    },
                    {
                        prop: 'icon', 
                        label: '图标', 
                        tips: '<a target="_blank" href="https://element.eleme.cn/#/zh-CN/component/icon">点击从图标库中选择</a>',
                        table: false
                    },
                    {
                        prop: 'curd',
                        label: '一键curd',  
                        type: 'switch',
                        default: 0, 
                        update: false,
                        tooltip: '自动生成控制器、模型、视图、增删改查权限菜单',
                        table: false, 
                    },
                    {
                        prop: 'status', 
                        label: '状态',  
                        type: 'switch', 
                        default: 1,
                        refresh: true,
                        width: '100px',
                    },
                    {
                        prop: 'ifshow', 
                        label: '显示',  
                        type: 'switch', 
                        default: 0, 
                        tooltip: '启动后在系统左侧显示',
                        refresh: true,
                        width: '100px', 
                    },
                    {
                        prop: 'logwriting', 
                        label: '日志',  
                        type: 'switch', 
                        default: 1, 
                        tooltip: '启动后系统会自动记录该操作的日志',
                        width: '100px', 
                    },
                ],
            }
        },
        methods: {
            getData(p) {
                parent.parentVm.menu = p.res.publicMenu;
            }
        }
    })
</script>
{include file="$footer" /}